package com.stud;

import com.stud.service.ServiceWrapper;
import com.stud.view.ClientView;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class ClientMain {

    public static void main(String[] args) throws RemoteException, NotBoundException {
        ServiceWrapper service = registerService();

        ClientView clientView = new ClientView(service);
        clientView.display();
    }

    private static ServiceWrapper registerService() throws RemoteException, NotBoundException {
        Registry registry = LocateRegistry.getRegistry(30001);
        return new ServiceWrapper((com.stud.rmi.Service) registry.lookup("Service"));
    }
}
